package com.yp.lession.redisqf211.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author: COS
 * @time: 2022/3/25 15:09
 * @description:
 */
@Configuration
@EnableSwagger2
@EnableKnife4j
@Import(BeanValidatorPluginsConfiguration.class)
public class KnifeConfig {

    @Bean
    public Docket buildKnife4j() {
        ApiInfo info = new ApiInfoBuilder()
                .title("员工OA管理系统")
                .version("V1.02")
                .contact(new Contact("cos", "xxxx", "xxxxx"))
                .description("方便公司管理员工操作系统")
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(info)
                .groupName("java1.0")
                .select()
                .apis(
                        RequestHandlerSelectors
                                .basePackage("com.yp.lession.redisqf211.controller")
                ).paths(PathSelectors.any())
                .build();
    }


}
